home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
36
/
testdis6.zip
/
TESTDIS6.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-11-21
|
16KB
|
378 lines
;TestDis6.ASM Exe program to load a font into the VGA adapter by
;using the VGA registers, thus by passing int 10, and DESQview.
;(Which means you can use this program to run DESQview with your
;favorite font.) Of course you need a VGA adapter to use this program.
;Also I make a call to a DOS 3.0+ function, but that can be changed
;to allow you to run this with a earlier DOS version.
;
;Note: switching video modes still will blow out the font. The advantage
;here is that normally DESQview captures int 10 and stores the font. Then
;you can only see it in the one window. This method changes the font GLOBALLY.
;With the provided PIF it loads the font and exits, freeing the ram.
;
;Syntax: Testdis6 fontfile.fnt
;
; ---By Christopher J. Vaisvil 11/21/90
;
;If you like, use any or all of this code.
;(I would like to be mentioned, just so I know you actually used
;the code...it would be neat to see someone do so!)
;
;This code and program are free, and your use of them frees _me_
;from any liability arising from the use or lack of use of either.
;
;This is free because I haven't paided as many shareware fees as I
;would like, so I'm giving something back to the BBS world.
;Thanks to all of the great programmers out there!!
;
;MASM 5.1 used to write this program.
;I know the code could have been written much, much more efficently.
;However, I'm still learning and am happy the bugger don't lock up my
;machine! If you have any hints/comments, try the C-ASM national network.
;I've included a sample DV PIF file and a couple of fonts to get you
;started.
;
;And now for the code....
;
PushRegs MACRO
push ax
push bx
push cx
push dx
push ds
push es
push di
push si
push ss
push sp
ENDM
;----------------------------------------------------------
PopRegs MACRO
pop sp
pop ss
pop si
pop di
pop es
pop ds
pop dx
pop cx
pop bx
pop ax
ENDM
;----------------------------------------------------------
DOSSEG
.MODEL LARGE ;Much better safe than sorry....
.STACK 1000h ;so I waste some ram.
.DATA
savepsp DW 0000h ;store the program PSP
Seqparms1 DW 0100h ;sync reset
DW 0402h ;CPU writes to map 2
DW 0704h ;sequential addressing
DW 0300h ;clear sync reset
GCParms1 DW 0204h ;map 2 for CPU reads
DW 0005h ;disable even-odd addrs'ing
DW 0006h ;map starts at A000h
Seqparms2 DW 0100h ;sync reset
DW 0302h ;CPU write to maps 0 and 2
DW 0304h ;odd-even addr'ing
DW 0300h ;clear sync reset
GCparms2 DW 0004h ;select map 0 for CPU reads
DW 1005h ;enable even-odd addr'ing
DW 0E06h ;map starts @ B800:0000h
font DB 4096d DUP(?) ;Array for Font Table
lfont EQU $ - font ;length of table
points DW 0000 ;bytes per character
rowsnow DB 00 ;character rows on screen - 1
fontseg DW 0000 ;ROM font segment
fontoff DW 0000 ;ROM font offset
bytesread DW 0000
crlf DW 13,10
openmsg DB '*** Open Error ***'
Showmsg DB 'Thanks for Using Me!'
row DW 0000
Column DW 0000
filename DB " "
parameters DB 127d DUP(" ")
paraptr DW 0000
error DB "DISK IO ERROR",13,10
lerror EQU $ - error
errortype DB "...I'm confused!",13,10
lerrortype EQU $ - errortype
handle DW 0000
dishan DB "ab"
ldishan EQU $ - dishan
message DB "The DickensSoft VGA Font File Loader ",13,10
lmessage EQU $ - message
message2 DB " is the file handle.",13,10
lmessage2 EQU $ - message2
secptr DW 0000
disptr DW 0000
Error_status DW 0000
.CODE
Start:
mov ax,@DATA ;initalize
mov ds,ax ;the data segment
call Get_PSP_Addrs ;Using procedures
call Command_Line ;sure cleans things
call e10open ;up don't it?
call Read_Font_File ;See the routines
call Set_Text ;for the details.
call Get_VGA_Info
call Show_Logo
call OpenCharMap
call Fill_Def
call CloseCharMap
byebye: mov ax,4C00h ;go back to DOS
int 21h
;----------------------------------------------------------
Command_Line Proc near
PushRegs
mov bx,savepsp ;get PSP addrs
mov es,bx ;set it up
mov bx,0 ;make sure bx is zero
mov bl,es:[80h] ;grab the #of bytes in param list
cmp bx,0 ;did we get parameters?
je Bad_Parameter ;no, exit
mov cx,bx ;yes, get how long the list is
inc cx ;grab 0dh also
mov bx,81h ;set up ptr into param list
mov paraptr,00 ;set up vari ptr
getparam:
mov ah,BYTE PTR es:[bx] ;get char from list
cmp ah,20h ;space?
je bypass_byte ;skip it
mov di,OFFSET filename ;point to variable
add di,paraptr ;add ptr to ptr
cmp ah,0dh ;cr?
jne go_on ;nope, bypass
mov ah,00 ;zero it for ASCIIZ
go_on:
mov [di],ah ;put it into filename, byte-wise
add paraptr,1
bypass_byte:
add bx,1 ;move ptr to next byte
loop getparam ;loop till done
PopRegs
ret ;run the main body
Bad_Parameter:
PopRegs
call x10err ;display error
mov ax,4C00h ;go back to DOS
int 21h
ret
Command_Line endp
;----------------------------------------------------------
Get_PSP_Addrs Proc near ;get the command line addrs (DOS 3.0+)
push ax ;save ax
push bx ;save bx
mov ax,6200h ;get PSP addrs (DOS 3.0+ only)
int 21h ;call DOS
mov savepsp,bx ;grab the PSP addrs
pop bx ;restore
pop ax ;registers
ret
Get_PSP_Addrs ENDP
;----------------------------------------------------------
Set_Text Proc Near ;set 80*25 text mode
push ax ;save AX
mov ax,0003h ;req func 0, mode 3
int 10h ;have BIOS do it
pop ax ;restore AX
ret
Set_Text EndP
;----------------------------------------------------------
OpenCharMap Proc Near
PushRegs ;push all regs
mov dx,03c4h ;sequencer port addrs
mov si,offset DGROUP:Seqparms1
mov cx,4
OCM1:
lodsw ;mov word to ax
out dx,ax ;shove to port
loop OCM1 ;do cx times
mov dl,00ceh ;Graphics controller addrs
mov si,offset DGROUP:GCparms1
mov cx,3
OCM2:
lodsw ;mov word to ax
out dx,ax ;shove to port
loop OCM2 ;do cx times
PopRegs
ret
OpenCharMap EndP
;----------------------------------------------------------
CloseCharMap Proc Near
PushRegs ;push all regs
mov dx,03c4h ;sequencer port addrs
mov si,offset DGROUP:Seqparms2
mov cx,4
CCM1:
lodsw ;mov word to ax
out dx,ax ;shove to port
loop CCM1 ;do cx times
mov dl,00ceh ;Graphics controller addrs
mov si,offset DGROUP:GCparms2
mov cx,3
CCM2:
lodsw ;mov word to ax
out dx,ax ;shove to port
loop CCM2 ;do cx times
mov ah,0fh ;get video mode
int 10h ;ask bios to do it
cmp al,7 ;is it mono?
jne CCM3 ;if not jump...
mov ax,0806h ;must be mono
out dx,ax ;set addrs to b000h
CCM3:
;B800h (color) already set in GCparms2
PopRegs
ret
CloseCharMap EndP
;----------------------------------------------------------
Fill_Def Proc near
PushRegs
mov cx,4096d ;number of char definitions
mov bx,0 ;start at zero
mov ax,0a000h ;char def addrs
mov es,ax ;set it up
mov ax,WORD PTR font[bx];grab first byte
mov dx,bx ;set up def tbl ptr
mov disptr,0 ;set up counter
Fill_def_1:
xchg bx,dx ;make MASM happy....
mov es:[bx],ax ;char def to video ram
xchg bx,dx ;get old value
inc bx ;need to increment the ptrs
inc dx ;as we grab words
inc disptr ;increase scanline counter
cmp disptr,16d ;done a character?
je adjust
returns:
mov al,BYTE PTR font[bx];get next char def
loop fill_def_1 ;do next char definition
PopRegs
ret
adjust:
mov disptr,0 ;zero counter
add dx,16d ;jump 16 scan lines in definition
jmp returns ;go back to work
PopRegs
ret
fill_def endp
;---------------Disk IO error routine----------------------
x10err proc near
mov ax,0600h ;clear screen
call q10scr ;clear screen
call q20curs ;set cursor
mov bx,1 ;Show who we are..
mov cx,lmessage
mov dx,OFFSET message
mov ax,4000h
int 21h
mov dx,OFFSET openmsg
mov ah,40h ;DX contains addrs, set on call
mov bx,01 ;screen IO handle
mov cx,20 ;length of msg
int 21h ;call DOS to display
ret
x10err endp
;---------------Scroll Screen------------------------------
q10scr proc near ;AX set on entry
mov bh,1eh ;set color
mov cx,0000 ;
mov dx,184fh ;request scroll
int 10h ;call video bios
ret
q10scr endp
;---------------Set Cursor---------------------------------
q20curs proc near
mov ah,02 ;request set
mov bh,00 ;cursor
mov dh,BYTE PTR row ;row
mov dl,BYTE PTR disptr ;column
int 10h ;call video bios
ret
q20curs endp
;---------------read sector--------------------------------
r10read proc near
pushregs
mov ax,3f00h ;request read
mov bx,handle ;device
mov cx,lfont ;length of buffer
mov dx,OFFSET font ;addrs of buffer
int 21h ;call DOS
mov bytesread,ax ;get # bytes read
popregs
ret
r10read endp
;---------------open file----------------------------------
e10open proc near
mov ah,3dh ;request open
mov al,00 ;read only
mov dx,OFFSET filename
int 21h ;
jc e20 ;Error?
mov handle,ax ;no - save handle
ret
e20:
mov bytesread,01 ;yes --
mov dx,OFFSET openmsg ;error message
call x10err
ret
e10open endp
;----------------------------------------------------------
Get_VGA_Info Proc Near ;get VGA info. Not much of its used now...
PushRegs
mov ah,11h ;BIOS int 11h
mov al,30h ;Function 30h
mov bh,06h ;get VGA 8x16 font in ROM
int 10h ;tell video BIOS to do it
mov ax,es ;get font segment
mov fontseg,ax ;store it
mov ax,bp ;get font offset
mov fontoff,ax ;store it
mov al,dl ;get char rows
mov rowsnow,al ;store it
mov ax,cx ;get bytes per char
mov points,ax ;store it
PopRegs
Ret
Get_VGA_Info endp
;----------------------------------------------------------
Read_Font_File Proc Near ;call a routine to read in the specified font
PushRegs
Load_The_Font:
call r10read ;get the font into ram
Loaded:
PopRegs ;we are done, let's return
ret
Read_Font_File endp
;----------------------------------------------------------
Show_Logo proc near ;show who wrote me
mov ax,0600h ;clear screen
call q10scr ;clear screen
call q20curs ;set cursor
mov bx,1 ;Show who we are..
mov cx,lmessage
mov dx,OFFSET message
mov ax,4000h
int 21h
mov dx,OFFSET Showmsg
mov ah,40h ;DX contains addrs, set on call
mov bx,01 ;screen IO handle
mov cx,22 ;length of msg
int 21h ;call DOS to display
ret
Show_Logo endp
;----------------------------------------------------------
End Start
;---------------------------------------------------------------------